import { assertEquals } from "asserts";

import validateStackSequences from "./index.ts";

Deno.test("validate-stack-sequences", () => {
    const inputs = [
        [
            831,
            875,
            546,
            367,
            816,
            118,
            970,
            571,
            225,
            578,
            466,
            187,
            36,
            392,
            138,
            427,
            161,
            174,
            623,
            10,
            153,
            288,
            818,
            497,
            980,
            34,
            161,
            15,
            58,
            624,
            587,
            261,
            842,
            27,
            17,
            977,
            177,
            761,
            482,
            243,
            609,
            266,
            609,
            613,
            343,
            268,
            686,
            86,
            759,
            783,
            557,
            724,
            556,
            882,
            550,
            128,
            473,
            410,
            265,
            454,
            37,
            482,
            276,
            625,
            644,
            417,
            392,
            665,
            411,
            346,
            305,
            115,
            754,
            787,
            876,
            453,
            136,
            400,
            761,
            933,
            975,
            130,
            547,
            806,
            165,
            664,
            334,
            542,
            55,
            292,
            355,
            961,
            264,
            359,
            91,
            593,
            680,
            712,
            434,
            47,
            397,
            420,
            568,
            394,
            631,
            206,
            151,
            990,
            89,
            591,
            326,
            290,
            197,
            26,
            655,
            108,
            246,
            983,
            309,
            22,
            601,
            754,
            999,
            562,
            314,
            425,
            869,
            486,
            225,
            883,
            540,
            524,
            248,
            305,
            813,
            269,
            933,
            13,
            614,
            731,
            446,
            769,
            551,
            2,
            735,
            206,
            537,
            546,
            108,
            766,
            201,
            980,
            655,
            0,
            748,
            301,
            655,
            499,
            287,
            886,
            837,
            111,
            900,
            922,
            923,
            261,
            260,
            969,
            450,
            200,
            708,
            642,
            933,
            494,
            377,
            947,
            208,
            249,
            463,
            396,
            864,
            969,
            998,
            934,
            850,
            572,
            963,
            78,
            923,
            454,
            46,
            192,
            312,
            555,
            72,
            630,
            538,
            958,
            441,
            894,
            193,
            506,
            951,
            62,
            872,
            140,
            351,
            399,
            505,
            439,
            968,
            438,
            998,
            999,
            936,
            907,
            961,
            932,
            590,
            407,
            892,
            615,
            460,
            424,
            46,
            890,
            296,
            521,
            108,
            553,
            434,
            674,
            395,
            716,
            320,
            980,
            900,
            495,
            699,
            262,
            80,
            432,
            761,
            5,
            66,
            839,
            527,
            632,
            571,
            504,
            590,
            889,
            9,
            212,
            253,
            688,
            557,
            903,
            799,
            403,
            498,
            798,
            787,
            13,
            148,
            849,
            562,
            566,
            231,
            451,
            996,
            344,
            307,
            92,
            472,
            176,
            47,
            774,
            462,
            654,
            454,
            194,
            37,
            888,
            951,
            47,
            598,
            589,
            711,
            341,
            593,
            222,
            462,
            205,
            210,
            188,
            134,
            759,
            314,
            955,
            27,
            826,
            274,
            696,
            391,
            406,
            276,
            279,
            856,
            170,
            581,
            991,
            386,
            425,
            398,
            418,
            334,
            841,
            662,
            977,
            451,
            405,
            519,
            740,
            134,
            675,
            543,
            338,
            855,
            630,
            141,
            309,
            256,
            243,
            415,
            394,
            569,
            1,
            526,
            320,
            655,
            611,
            55,
            968,
            701,
            698,
            891,
            755,
            381,
            820,
            674,
            276,
            753,
            191,
            166,
            402,
            663,
            557,
            174,
            694,
            756,
            30,
            271,
            873,
            496,
            887,
            855,
            387,
            707,
            970,
            762,
            355,
            355,
            89,
            547,
            780,
            359,
            58,
            857,
            773,
            982,
            875,
            479,
            393,
            954,
            966,
            230,
            106,
            484,
            796,
            551,
            517,
            561,
            907,
            86,
            602,
            709,
            329,
            105,
            487,
            552,
            303,
            777,
            211,
            406,
            719,
            246,
            260,
            182,
            566,
            716,
            354,
            176,
            454,
            209,
            28,
            325,
            860,
            592,
            817,
            282,
            778,
            116,
            889,
            97,
            71,
            619,
            108,
            77,
            431,
            669,
            959,
            893,
            415,
            820,
            989,
            475,
            319,
            699,
            203,
            341,
            549,
            375,
            710,
            977,
            671,
            452,
            886,
            880,
            512,
            818,
            842,
            252,
            67,
            300,
            247,
            558,
            484,
            48,
            580,
            505,
            591,
            975,
            242,
            433,
            552,
            391,
            525,
            984,
            755,
            663,
            343,
            170,
            234,
            900,
            441,
            34,
            813,
            615,
            125,
            483,
            741,
            180,
            452,
            173,
            151,
            535,
            813,
            217,
            247,
            668,
            448,
            160,
            148,
            446,
            511,
            944,
            777,
            432,
            894,
            849,
            870,
            428,
            84,
            644,
            616,
            512,
            631,
            205,
            677,
            501,
            713,
            94,
            289,
            402,
            88,
            856,
            798,
            473,
            332,
            506,
            863,
            828,
            713,
            311,
            861,
            921,
            853,
            644,
            611,
            318,
            742,
            409,
            545,
            283,
            168,
            920,
            814,
            302,
            902,
            353,
            544,
            645,
            663,
            499,
            504,
            859,
            95,
            51,
            48,
            430,
            108,
            620,
            259,
            846,
            919,
            436,
            806,
            144,
            196,
            512,
            160,
            278,
            653,
            866,
            642,
            566,
            394,
            259,
            485,
            28,
            797,
            803,
            188,
            399,
            718,
            259,
            390,
            113,
            570,
            388,
            332,
            661,
            848,
            575,
            959,
            255,
            215,
            214,
            229,
            539,
            890,
            570,
            673,
            767,
            496,
            22,
            594,
            440,
            15,
            578,
            569,
            530,
            440,
            978,
            310,
            248,
            841,
            335,
            158,
            625,
            970,
            336,
            573,
            389,
            376,
            195,
            309,
            470,
            737,
            18,
            425,
            998,
            546,
            375,
            425,
            993,
            640,
            417,
            365,
            371,
            975,
            227,
            586,
            969,
            460,
            954,
            863,
            866,
            748,
            187,
            275,
            139,
            775,
            9,
            133,
            448,
            71,
            706,
            408,
            184,
            363,
            575,
            799,
            340,
            5,
            798,
            51,
            579,
            716,
            325,
            174,
            677,
            316,
            980,
            367,
            493,
            629,
            417,
            430,
            719,
            270,
            742,
            888,
            547,
            927,
            472,
            9,
            439,
            736,
            596,
            921,
            952,
            949,
            418,
            984,
            995,
            93,
            494,
            109,
            631,
            698,
            805,
            825,
            724,
            679,
            835,
            496,
            344,
            557,
            6,
            785,
            438,
            434,
            401,
            664,
            543,
            213,
            269,
            703,
            659,
            957,
            727,
            683,
            898,
            939,
            131,
            607,
            84,
            448,
            229,
            379,
            967,
            513,
            27,
            318,
            398,
            233,
            688,
            995,
            277,
            635,
            791,
            130,
            145,
            991,
            856,
            271,
            974,
            885,
            967,
            878,
            839,
            720,
            95,
            90,
            750,
            641,
            997,
            553,
            757,
            890,
            393,
            867,
            866,
            427,
            29,
            813,
            576,
            867,
            800,
            54,
            104,
            642,
            142,
            378,
            801,
            211,
            411,
            247,
            634,
            711,
            590,
            245,
            888,
            767,
            737,
            754,
            876,
            296,
            135,
            926,
            220,
            25,
            824,
            83,
            256,
            829,
            493,
            86,
            699,
            111,
            12,
            691,
            559,
            322,
            963,
            31,
            499,
            979,
            189,
            746,
            919,
            654,
            505,
            474,
            261,
            871,
            512,
            176,
            496,
            431,
            241,
            202,
            196,
            253,
            463,
            262,
            329,
            315,
            522,
            742,
            557,
            875,
            766,
            378,
            756,
            877,
            234,
            714,
            122,
            33,
            709,
            266,
            31,
            950,
            73,
            978,
            877,
            64,
            148,
            975,
            116,
            414,
            694,
            185,
            748,
            281,
            598,
            294,
            134,
            160,
            469,
            363,
            999,
            198,
            127,
            825,
            387,
            695,
            409,
            586,
            8,
            369,
            213,
            522,
            108,
            203,
            258,
            936,
            415,
            267,
            765,
            36,
            954,
            851,
            451,
            702,
            939,
            741,
            214,
            103,
            763,
            544,
            275,
            94,
            661,
            70,
            483,
            210,
            990,
            533,
            746,
            235,
            343,
            916,
            152,
            582,
            26,
            570,
            905,
            65,
            770,
            633,
            819,
            509,
            226,
            377,
            455,
            350,
            766,
            712,
            128,
            21,
            367,
            845,
            419,
            11,
            895,
            902,
            708,
            602,
            43,
            182,
            767,
            754,
            435,
            313,
            856,
            123,
            67,
            702,
            118,
            468,
            227,
            671,
            676,
            835,
            608,
            670,
            466,
            104,
            330,
            777,
            840,
            546,
            886,
            144,
            60,
            981,
            659,
            444,
            748,
            237,
            230,
            904,
            751,
            274,
            952,
            544,
            115,
            352,
            302,
            433,
            192,
            916,
            638,
            786,
            815,
            462,
            412,
            153,
            428,
            447,
            855,
            432,
            632,
            709,
            679,
            451,
            100,
            833,
            255,
            545,
            73,
            59,
            65,
            131,
            209,
            790,
            705,
            256,
            523,
            936,
            961,
            391,
            545,
            460,
            927,
            675,
        ],
        [
            0,
            1,
            10,
            100,
            103,
            104,
            104,
            105,
            106,
            108,
            108,
            108,
            108,
            108,
            108,
            109,
            11,
            111,
            111,
            113,
            115,
            115,
            116,
            116,
            118,
            118,
            12,
            122,
            123,
            125,
            127,
            128,
            128,
            13,
            13,
            130,
            130,
            131,
            131,
            133,
            134,
            134,
            134,
            135,
            136,
            138,
            139,
            140,
            141,
            142,
            144,
            144,
            145,
            148,
            148,
            148,
            15,
            15,
            151,
            151,
            152,
            153,
            153,
            158,
            160,
            160,
            160,
            161,
            161,
            165,
            166,
            168,
            17,
            170,
            170,
            173,
            174,
            174,
            174,
            176,
            176,
            176,
            177,
            18,
            180,
            182,
            182,
            184,
            185,
            187,
            187,
            188,
            188,
            189,
            191,
            192,
            192,
            193,
            194,
            195,
            196,
            196,
            197,
            198,
            2,
            200,
            201,
            202,
            203,
            203,
            205,
            205,
            206,
            206,
            208,
            209,
            209,
            21,
            210,
            210,
            211,
            211,
            212,
            213,
            213,
            214,
            214,
            215,
            217,
            22,
            22,
            220,
            222,
            225,
            225,
            226,
            227,
            227,
            229,
            229,
            230,
            230,
            231,
            233,
            234,
            234,
            235,
            237,
            241,
            242,
            243,
            243,
            245,
            246,
            246,
            247,
            247,
            247,
            248,
            248,
            249,
            25,
            252,
            253,
            253,
            255,
            255,
            256,
            256,
            256,
            258,
            259,
            259,
            259,
            26,
            26,
            260,
            260,
            261,
            261,
            261,
            262,
            262,
            264,
            265,
            266,
            266,
            267,
            268,
            269,
            269,
            27,
            27,
            27,
            270,
            271,
            271,
            274,
            274,
            275,
            275,
            276,
            276,
            276,
            277,
            278,
            279,
            28,
            28,
            281,
            282,
            283,
            287,
            288,
            289,
            29,
            290,
            292,
            294,
            296,
            296,
            30,
            300,
            301,
            302,
            302,
            303,
            305,
            305,
            307,
            309,
            309,
            309,
            31,
            31,
            310,
            311,
            312,
            313,
            314,
            314,
            315,
            316,
            318,
            318,
            319,
            320,
            320,
            322,
            325,
            325,
            326,
            329,
            329,
            33,
            330,
            332,
            332,
            334,
            334,
            335,
            336,
            338,
            34,
            34,
            340,
            341,
            341,
            343,
            343,
            343,
            344,
            344,
            346,
            350,
            351,
            352,
            353,
            354,
            355,
            355,
            355,
            359,
            359,
            36,
            36,
            363,
            363,
            365,
            367,
            367,
            367,
            369,
            37,
            37,
            371,
            375,
            375,
            376,
            377,
            377,
            378,
            378,
            379,
            381,
            386,
            387,
            387,
            388,
            389,
            390,
            391,
            391,
            391,
            392,
            392,
            393,
            393,
            394,
            394,
            394,
            395,
            396,
            397,
            398,
            398,
            399,
            399,
            400,
            401,
            402,
            402,
            403,
            405,
            406,
            406,
            407,
            408,
            409,
            409,
            410,
            411,
            411,
            412,
            414,
            415,
            415,
            415,
            417,
            417,
            417,
            418,
            418,
            419,
            420,
            424,
            425,
            425,
            425,
            425,
            427,
            427,
            428,
            428,
            43,
            430,
            430,
            431,
            431,
            432,
            432,
            432,
            433,
            433,
            434,
            434,
            434,
            435,
            436,
            438,
            438,
            439,
            439,
            440,
            440,
            441,
            441,
            444,
            446,
            446,
            447,
            448,
            448,
            448,
            450,
            451,
            451,
            451,
            451,
            452,
            452,
            453,
            454,
            454,
            454,
            454,
            455,
            46,
            46,
            460,
            460,
            460,
            462,
            462,
            462,
            463,
            463,
            466,
            466,
            468,
            469,
            47,
            47,
            47,
            470,
            472,
            472,
            473,
            473,
            474,
            475,
            479,
            48,
            48,
            482,
            482,
            483,
            483,
            484,
            484,
            485,
            486,
            487,
            493,
            493,
            494,
            494,
            495,
            496,
            496,
            496,
            496,
            497,
            498,
            499,
            499,
            499,
            5,
            5,
            501,
            504,
            504,
            505,
            505,
            505,
            506,
            506,
            509,
            51,
            51,
            511,
            512,
            512,
            512,
            512,
            513,
            517,
            519,
            521,
            522,
            522,
            523,
            524,
            525,
            526,
            527,
            530,
            533,
            535,
            537,
            538,
            539,
            54,
            540,
            542,
            543,
            543,
            544,
            544,
            544,
            545,
            545,
            545,
            546,
            546,
            546,
            546,
            547,
            547,
            547,
            549,
            55,
            55,
            550,
            551,
            551,
            552,
            552,
            553,
            553,
            555,
            556,
            557,
            557,
            557,
            557,
            557,
            558,
            559,
            561,
            562,
            562,
            566,
            566,
            566,
            568,
            569,
            569,
            570,
            570,
            570,
            571,
            571,
            572,
            573,
            575,
            575,
            576,
            578,
            578,
            579,
            58,
            58,
            580,
            581,
            582,
            586,
            586,
            587,
            589,
            59,
            590,
            590,
            590,
            591,
            591,
            592,
            593,
            593,
            594,
            596,
            598,
            598,
            6,
            60,
            601,
            602,
            602,
            607,
            608,
            609,
            609,
            611,
            611,
            613,
            614,
            615,
            615,
            616,
            619,
            62,
            620,
            623,
            624,
            625,
            625,
            629,
            630,
            630,
            631,
            631,
            631,
            632,
            632,
            633,
            634,
            635,
            638,
            64,
            640,
            641,
            642,
            642,
            642,
            644,
            644,
            644,
            645,
            65,
            65,
            653,
            654,
            654,
            655,
            655,
            655,
            655,
            659,
            659,
            66,
            661,
            661,
            662,
            663,
            663,
            663,
            664,
            664,
            665,
            668,
            669,
            67,
            67,
            670,
            671,
            671,
            673,
            674,
            674,
            675,
            675,
            676,
            677,
            677,
            679,
            679,
            680,
            683,
            686,
            688,
            688,
            691,
            694,
            694,
            695,
            696,
            698,
            698,
            699,
            699,
            699,
            70,
            701,
            702,
            702,
            703,
            705,
            706,
            707,
            708,
            708,
            709,
            709,
            709,
            71,
            71,
            710,
            711,
            711,
            712,
            712,
            713,
            713,
            714,
            716,
            716,
            716,
            718,
            719,
            719,
            72,
            720,
            724,
            724,
            727,
            73,
            73,
            731,
            735,
            736,
            737,
            737,
            740,
            741,
            741,
            742,
            742,
            742,
            746,
            746,
            748,
            748,
            748,
            748,
            750,
            751,
            753,
            754,
            754,
            754,
            754,
            755,
            755,
            756,
            756,
            757,
            759,
            759,
            761,
            761,
            761,
            762,
            763,
            765,
            766,
            766,
            766,
            767,
            767,
            767,
            769,
            77,
            770,
            773,
            774,
            775,
            777,
            777,
            777,
            778,
            78,
            780,
            783,
            785,
            786,
            787,
            787,
            790,
            791,
            796,
            797,
            798,
            798,
            798,
            799,
            799,
            8,
            80,
            800,
            801,
            803,
            805,
            806,
            806,
            813,
            813,
            813,
            813,
            814,
            815,
            816,
            817,
            818,
            818,
            819,
            820,
            820,
            824,
            825,
            825,
            826,
            828,
            829,
            83,
            831,
            833,
            835,
            835,
            837,
            839,
            839,
            84,
            84,
            840,
            841,
            841,
            842,
            842,
            845,
            846,
            848,
            849,
            849,
            850,
            851,
            853,
            855,
            855,
            855,
            856,
            856,
            856,
            856,
            857,
            859,
            86,
            86,
            86,
            860,
            861,
            863,
            863,
            864,
            866,
            866,
            866,
            867,
            867,
            869,
            870,
            871,
            872,
            873,
            875,
            875,
            875,
            876,
            876,
            877,
            877,
            878,
            88,
            880,
            882,
            883,
            885,
            886,
            886,
            886,
            887,
            888,
            888,
            888,
            889,
            889,
            89,
            89,
            890,
            890,
            890,
            891,
            892,
            893,
            894,
            894,
            895,
            898,
            9,
            9,
            9,
            90,
            900,
            900,
            900,
            902,
            902,
            903,
            904,
            905,
            907,
            907,
            91,
            916,
            916,
            919,
            919,
            92,
            920,
            921,
            921,
            922,
            923,
            923,
            926,
            927,
            927,
            93,
            932,
            933,
            933,
            933,
            934,
            936,
            936,
            936,
            939,
            939,
            94,
            94,
            944,
            947,
            949,
            95,
            95,
            950,
            951,
            951,
            952,
            952,
            954,
            954,
            954,
            955,
            957,
            958,
            959,
            959,
            961,
            961,
            961,
            963,
            963,
            966,
            967,
            967,
            968,
            968,
            969,
            969,
            969,
            97,
            970,
            970,
            970,
            974,
            975,
            975,
            975,
            975,
            977,
            977,
            977,
            978,
            978,
            979,
            980,
            980,
            980,
            980,
            981,
            982,
            983,
            984,
            984,
            989,
            990,
            990,
            991,
            991,
            993,
            995,
            995,
            996,
            997,
            998,
            998,
            998,
            999,
            999,
            999,
        ],
        [
            831,
            875,
            546,
            367,
            816,
            118,
            970,
            571,
            225,
            578,
            466,
            187,
            36,
            392,
            138,
            427,
            161,
            174,
            623,
            10,
            153,
            288,
            818,
            497,
            980,
            34,
            161,
            15,
            58,
            624,
            587,
            261,
            842,
            27,
            17,
            977,
            177,
            761,
            482,
            243,
            609,
            266,
            609,
            613,
            343,
            268,
            686,
            86,
            759,
            783,
            557,
            724,
            556,
            882,
            550,
            128,
            473,
            410,
            265,
            454,
            37,
            482,
            276,
            625,
            644,
            417,
            392,
            665,
            411,
            346,
            305,
            115,
            754,
            787,
            876,
            453,
            136,
            400,
            761,
            933,
            975,
            130,
            547,
            806,
            165,
            664,
            334,
            542,
            55,
            292,
            355,
            961,
            264,
            359,
            91,
            593,
            680,
            712,
            434,
            47,
            397,
            420,
            568,
            394,
            631,
            206,
            151,
            990,
            89,
            591,
            326,
            290,
            197,
            26,
            655,
            108,
            246,
            983,
            309,
            22,
            601,
            754,
            999,
            562,
            314,
            425,
            869,
            486,
            225,
            883,
            540,
            524,
            248,
            305,
            813,
            269,
            933,
            13,
            614,
            731,
            446,
            769,
            551,
            2,
            735,
            206,
            537,
            546,
            108,
            766,
            201,
            980,
            655,
            0,
            748,
            301,
            655,
            499,
            287,
            886,
            837,
            111,
            900,
            922,
            923,
            261,
            260,
            969,
            450,
            200,
            708,
            642,
            933,
            494,
            377,
            947,
            208,
            249,
            463,
            396,
            864,
            969,
            998,
            934,
            850,
            572,
            963,
            78,
            923,
            454,
            46,
            192,
            312,
            555,
            72,
            630,
            538,
            958,
            441,
            894,
            193,
            506,
            951,
            62,
            872,
            140,
            351,
            399,
            505,
            439,
            968,
            438,
            998,
            999,
            936,
            907,
            961,
            932,
            590,
            407,
            892,
            615,
            460,
            424,
            46,
            890,
            296,
            521,
            108,
            553,
            434,
            674,
            395,
            716,
            320,
            980,
            900,
            495,
            699,
            262,
            80,
            432,
            761,
            5,
            66,
            839,
            527,
            632,
            571,
            504,
            590,
            889,
            9,
            212,
            253,
            688,
            557,
            903,
            799,
            403,
            498,
            798,
            787,
            13,
            148,
            849,
            562,
            566,
            231,
            451,
            996,
            344,
            307,
            92,
            472,
            176,
            47,
            774,
            462,
            654,
            454,
            194,
            37,
            888,
            951,
            47,
            598,
            589,
            711,
            341,
            593,
            222,
            462,
            205,
            210,
            188,
            134,
            759,
            314,
            955,
            27,
            826,
            274,
            696,
            391,
            406,
            276,
            279,
            856,
            170,
            581,
            991,
            386,
            425,
            398,
            418,
            334,
            841,
            662,
            977,
            451,
            405,
            519,
            740,
            134,
            675,
            543,
            338,
            855,
            630,
            141,
            309,
            256,
            243,
            415,
            394,
            569,
            1,
            526,
            320,
            655,
            611,
            55,
            968,
            701,
            698,
            891,
            755,
            381,
            820,
            674,
            276,
            753,
            191,
            166,
            402,
            663,
            557,
            174,
            694,
            756,
            30,
            271,
            873,
            496,
            887,
            855,
            387,
            707,
            970,
            762,
            355,
            355,
            89,
            547,
            780,
            359,
            58,
            857,
            773,
            982,
            875,
            479,
            393,
            954,
            966,
            230,
            106,
            484,
            796,
            551,
            517,
            561,
            907,
            86,
            602,
            709,
            329,
            105,
            487,
            552,
            303,
            777,
            211,
            406,
            719,
            246,
            260,
            182,
            566,
            716,
            354,
            176,
            454,
            209,
            28,
            325,
            860,
            592,
            817,
            282,
            778,
            116,
            889,
            97,
            71,
            619,
            108,
            77,
            431,
            669,
            959,
            893,
            415,
            820,
            989,
            475,
            319,
            699,
            203,
            341,
            549,
            375,
            710,
            977,
            671,
            452,
            886,
            880,
            512,
            818,
            842,
            252,
            67,
            300,
            247,
            558,
            484,
            48,
            580,
            505,
            591,
            975,
            242,
            433,
            552,
            391,
            525,
            984,
            755,
            663,
            343,
            170,
            234,
            900,
            441,
            34,
            813,
            615,
            125,
            483,
            741,
            180,
            452,
            173,
            151,
            535,
            813,
            217,
            247,
            668,
            448,
            160,
            148,
            446,
            511,
            944,
            777,
            432,
            894,
            849,
            870,
            428,
            84,
            644,
            616,
            512,
            631,
            205,
            677,
            501,
            713,
            94,
            289,
            402,
            88,
            856,
            798,
            473,
            332,
            506,
            863,
            828,
            713,
            311,
            861,
            921,
            853,
            644,
            611,
            318,
            742,
            409,
            545,
            283,
            168,
            920,
            814,
            302,
            902,
            353,
            544,
            645,
            663,
            499,
            504,
            859,
            95,
            51,
            48,
            430,
            108,
            620,
            259,
            846,
            919,
            436,
            806,
            144,
            196,
            512,
            160,
            278,
            653,
            866,
            642,
            566,
            394,
            259,
            485,
            28,
            797,
            803,
            188,
            399,
            718,
            259,
            390,
            113,
            570,
            388,
            332,
            661,
            848,
            575,
            959,
            255,
            215,
            214,
            229,
            539,
            890,
            570,
            673,
            767,
            496,
            22,
            594,
            440,
            15,
            578,
            569,
            530,
            440,
            978,
            310,
            248,
            841,
            335,
            158,
            625,
            970,
            336,
            573,
            389,
            376,
            195,
            309,
            470,
            737,
            18,
            425,
            998,
            546,
            375,
            425,
            993,
            640,
            417,
            365,
            371,
            975,
            227,
            586,
            969,
            460,
            954,
            863,
            866,
            748,
            187,
            275,
            139,
            775,
            9,
            133,
            448,
            71,
            706,
            408,
            184,
            363,
            575,
            799,
            340,
            5,
            798,
            51,
            579,
            716,
            325,
            174,
            677,
            316,
            980,
            367,
            493,
            629,
            417,
            430,
            719,
            270,
            742,
            888,
            547,
            927,
            472,
            9,
            439,
            736,
            596,
            921,
            952,
            949,
            418,
            984,
            995,
            93,
            494,
            109,
            631,
            698,
            805,
            825,
            724,
            679,
            835,
            496,
            344,
            557,
            6,
            785,
            438,
            434,
            401,
            664,
            543,
            213,
            269,
            703,
            659,
            957,
            727,
            683,
            898,
            939,
            131,
            607,
            84,
            448,
            229,
            379,
            967,
            513,
            27,
            318,
            398,
            233,
            688,
            995,
            277,
            635,
            791,
            130,
            145,
            991,
            856,
            271,
            974,
            885,
            967,
            878,
            839,
            720,
            95,
            90,
            750,
            641,
            997,
            553,
            757,
            890,
            393,
            867,
            866,
            427,
            29,
            813,
            576,
            867,
            800,
            54,
            104,
            642,
            142,
            378,
            801,
            211,
            411,
            247,
            634,
            711,
            590,
            245,
            888,
            767,
            737,
            754,
            876,
            296,
            135,
            926,
            220,
            25,
            824,
            83,
            256,
            829,
            493,
            86,
            699,
            111,
            12,
            691,
            559,
            322,
            963,
            31,
            499,
            979,
            189,
            746,
            919,
            654,
            505,
            474,
            261,
            871,
            512,
            176,
            496,
            431,
            241,
            202,
            196,
            253,
            463,
            262,
            329,
            315,
            522,
            742,
            557,
            875,
            766,
            378,
            756,
            877,
            234,
            714,
            122,
            33,
            709,
            266,
            31,
            950,
            73,
            978,
            877,
            64,
            148,
            975,
            116,
            414,
            694,
            185,
            748,
            281,
            598,
            294,
            134,
            160,
            469,
            363,
            999,
            198,
            127,
            825,
            387,
            695,
            409,
            586,
            8,
            369,
            213,
            522,
            108,
            203,
            258,
            936,
            415,
            267,
            765,
            36,
            954,
            851,
            451,
            702,
            939,
            741,
            214,
            103,
            763,
            544,
            275,
            94,
            661,
            70,
            483,
            210,
            990,
            533,
            746,
            235,
            343,
            916,
            152,
            582,
            26,
            570,
            905,
            65,
            770,
            633,
            819,
            509,
            226,
            377,
            455,
            350,
            766,
            712,
            128,
            21,
            367,
            845,
            419,
            11,
            895,
            902,
            708,
            602,
            43,
            182,
            767,
            754,
            435,
            313,
            856,
            123,
            67,
            702,
            118,
            468,
            227,
            671,
            676,
            835,
            608,
            670,
            466,
            104,
            330,
            777,
            840,
            546,
            886,
            144,
            60,
            981,
            659,
            444,
            748,
            237,
            230,
            904,
            751,
            274,
            952,
            544,
            115,
            352,
            302,
            433,
            192,
            916,
            638,
            786,
            815,
            462,
            412,
            153,
            428,
            447,
            855,
            432,
            632,
            709,
            679,
            451,
            100,
            833,
            255,
            545,
            73,
            59,
            65,
            131,
            209,
            790,
            705,
            256,
            523,
            936,
            961,
            391,
            545,
            460,
            927,
            675,
        ],
        [
            675,
            927,
            460,
            545,
            391,
            961,
            936,
            523,
            256,
            705,
            790,
            209,
            131,
            65,
            59,
            73,
            545,
            255,
            833,
            100,
            451,
            679,
            709,
            632,
            432,
            855,
            447,
            428,
            153,
            412,
            462,
            815,
            786,
            638,
            916,
            192,
            433,
            302,
            352,
            115,
            544,
            952,
            274,
            751,
            904,
            230,
            237,
            748,
            444,
            659,
            981,
            60,
            144,
            886,
            546,
            840,
            777,
            330,
            104,
            466,
            670,
            608,
            835,
            676,
            671,
            227,
            468,
            118,
            702,
            67,
            123,
            856,
            313,
            435,
            754,
            767,
            182,
            43,
            602,
            708,
            902,
            895,
            11,
            419,
            845,
            367,
            21,
            128,
            712,
            766,
            350,
            455,
            377,
            226,
            509,
            819,
            633,
            770,
            65,
            905,
            570,
            26,
            582,
            152,
            916,
            343,
            235,
            746,
            533,
            990,
            210,
            483,
            70,
            661,
            94,
            275,
            544,
            763,
            103,
            214,
            741,
            939,
            702,
            451,
            851,
            954,
            36,
            765,
            267,
            415,
            936,
            258,
            203,
            108,
            522,
            213,
            369,
            8,
            586,
            409,
            695,
            387,
            825,
            127,
            198,
            999,
            363,
            469,
            160,
            134,
            294,
            598,
            281,
            748,
            185,
            694,
            414,
            116,
            975,
            148,
            64,
            877,
            978,
            73,
            950,
            31,
            266,
            709,
            33,
            122,
            714,
            234,
            877,
            756,
            378,
            766,
            875,
            557,
            742,
            522,
            315,
            329,
            262,
            463,
            253,
            196,
            202,
            241,
            431,
            496,
            176,
            512,
            871,
            261,
            474,
            505,
            654,
            919,
            746,
            189,
            979,
            499,
            31,
            963,
            322,
            559,
            691,
            12,
            111,
            699,
            86,
            493,
            829,
            256,
            83,
            824,
            25,
            220,
            926,
            135,
            296,
            876,
            754,
            737,
            767,
            888,
            245,
            590,
            711,
            634,
            247,
            411,
            211,
            801,
            378,
            142,
            642,
            104,
            54,
            800,
            867,
            576,
            813,
            29,
            427,
            866,
            867,
            393,
            890,
            757,
            553,
            997,
            641,
            750,
            90,
            95,
            720,
            839,
            878,
            967,
            885,
            974,
            271,
            856,
            991,
            145,
            130,
            791,
            635,
            277,
            995,
            688,
            233,
            398,
            318,
            27,
            513,
            967,
            379,
            229,
            448,
            84,
            607,
            131,
            939,
            898,
            683,
            727,
            957,
            659,
            703,
            269,
            213,
            543,
            664,
            401,
            434,
            438,
            785,
            6,
            557,
            344,
            496,
            835,
            679,
            724,
            825,
            805,
            698,
            631,
            109,
            494,
            93,
            995,
            984,
            418,
            949,
            952,
            921,
            596,
            736,
            439,
            9,
            472,
            927,
            547,
            888,
            742,
            270,
            719,
            430,
            417,
            629,
            493,
            367,
            980,
            316,
            677,
            174,
            325,
            716,
            579,
            51,
            798,
            5,
            340,
            799,
            575,
            363,
            184,
            408,
            706,
            71,
            448,
            133,
            9,
            775,
            139,
            275,
            187,
            748,
            866,
            863,
            954,
            460,
            969,
            586,
            227,
            975,
            371,
            365,
            417,
            640,
            993,
            425,
            375,
            546,
            998,
            425,
            18,
            737,
            470,
            309,
            195,
            376,
            389,
            573,
            336,
            970,
            625,
            158,
            335,
            841,
            248,
            310,
            978,
            440,
            530,
            569,
            578,
            15,
            440,
            594,
            22,
            496,
            767,
            673,
            570,
            890,
            539,
            229,
            214,
            215,
            255,
            959,
            575,
            848,
            661,
            332,
            388,
            570,
            113,
            390,
            259,
            718,
            399,
            188,
            803,
            797,
            28,
            485,
            259,
            394,
            566,
            642,
            866,
            653,
            278,
            160,
            512,
            196,
            144,
            806,
            436,
            919,
            846,
            259,
            620,
            108,
            430,
            48,
            51,
            95,
            859,
            504,
            499,
            663,
            645,
            544,
            353,
            902,
            302,
            814,
            920,
            168,
            283,
            545,
            409,
            742,
            318,
            611,
            644,
            853,
            921,
            861,
            311,
            713,
            828,
            863,
            506,
            332,
            473,
            798,
            856,
            88,
            402,
            289,
            94,
            713,
            501,
            677,
            205,
            631,
            512,
            616,
            644,
            84,
            428,
            870,
            849,
            894,
            432,
            777,
            944,
            511,
            446,
            148,
            160,
            448,
            668,
            247,
            217,
            813,
            535,
            151,
            173,
            452,
            180,
            741,
            483,
            125,
            615,
            813,
            34,
            441,
            900,
            234,
            170,
            343,
            663,
            755,
            984,
            525,
            391,
            552,
            433,
            242,
            975,
            591,
            505,
            580,
            48,
            484,
            558,
            247,
            300,
            67,
            252,
            842,
            818,
            512,
            880,
            886,
            452,
            671,
            977,
            710,
            375,
            549,
            341,
            203,
            699,
            319,
            475,
            989,
            820,
            415,
            893,
            959,
            669,
            431,
            77,
            108,
            619,
            71,
            97,
            889,
            116,
            778,
            282,
            817,
            592,
            860,
            325,
            28,
            209,
            454,
            176,
            354,
            716,
            566,
            182,
            260,
            246,
            719,
            406,
            211,
            777,
            303,
            552,
            487,
            105,
            329,
            709,
            602,
            86,
            907,
            561,
            517,
            551,
            796,
            484,
            106,
            230,
            966,
            954,
            393,
            479,
            875,
            982,
            773,
            857,
            58,
            359,
            780,
            547,
            89,
            355,
            355,
            762,
            970,
            707,
            387,
            855,
            887,
            496,
            873,
            271,
            30,
            756,
            694,
            174,
            557,
            663,
            402,
            166,
            191,
            753,
            276,
            674,
            820,
            381,
            755,
            891,
            698,
            701,
            968,
            55,
            611,
            655,
            320,
            526,
            1,
            569,
            394,
            415,
            243,
            256,
            309,
            141,
            630,
            855,
            338,
            543,
            675,
            134,
            740,
            519,
            405,
            451,
            977,
            662,
            841,
            334,
            418,
            398,
            425,
            386,
            991,
            581,
            170,
            856,
            279,
            276,
            406,
            391,
            696,
            274,
            826,
            27,
            955,
            314,
            759,
            134,
            188,
            210,
            205,
            462,
            222,
            593,
            341,
            711,
            589,
            598,
            47,
            951,
            888,
            37,
            194,
            454,
            654,
            462,
            774,
            47,
            176,
            472,
            92,
            307,
            344,
            996,
            451,
            231,
            566,
            562,
            849,
            148,
            13,
            787,
            798,
            498,
            403,
            799,
            903,
            557,
            688,
            253,
            212,
            9,
            889,
            590,
            504,
            571,
            632,
            527,
            839,
            66,
            5,
            761,
            432,
            80,
            262,
            699,
            495,
            900,
            980,
            320,
            716,
            395,
            674,
            434,
            553,
            108,
            521,
            296,
            890,
            46,
            424,
            460,
            615,
            892,
            407,
            590,
            932,
            961,
            907,
            936,
            999,
            998,
            438,
            968,
            439,
            505,
            399,
            351,
            140,
            872,
            62,
            951,
            506,
            193,
            894,
            441,
            958,
            538,
            630,
            72,
            555,
            312,
            192,
            46,
            454,
            923,
            78,
            963,
            572,
            850,
            934,
            998,
            969,
            864,
            396,
            463,
            249,
            208,
            947,
            377,
            494,
            933,
            642,
            708,
            200,
            450,
            969,
            260,
            261,
            923,
            922,
            900,
            111,
            837,
            886,
            287,
            499,
            655,
            301,
            748,
            0,
            655,
            980,
            201,
            766,
            108,
            546,
            537,
            206,
            735,
            2,
            551,
            769,
            446,
            731,
            614,
            13,
            933,
            269,
            813,
            305,
            248,
            524,
            540,
            883,
            225,
            486,
            869,
            425,
            314,
            562,
            999,
            754,
            601,
            22,
            309,
            983,
            246,
            108,
            655,
            26,
            197,
            290,
            326,
            591,
            89,
            990,
            151,
            206,
            631,
            394,
            568,
            420,
            397,
            47,
            434,
            712,
            680,
            593,
            91,
            359,
            264,
            961,
            355,
            292,
            55,
            542,
            334,
            664,
            165,
            806,
            547,
            130,
            975,
            933,
            761,
            400,
            136,
            453,
            876,
            787,
            754,
            115,
            305,
            346,
            411,
            665,
            392,
            417,
            644,
            625,
            276,
            482,
            37,
            454,
            265,
            410,
            473,
            128,
            550,
            882,
            556,
            724,
            557,
            783,
            759,
            86,
            686,
            268,
            343,
            613,
            609,
            266,
            609,
            243,
            482,
            761,
            177,
            977,
            17,
            27,
            842,
            261,
            587,
            624,
            58,
            15,
            161,
            34,
            980,
            497,
            818,
            288,
            153,
            10,
            623,
            174,
            161,
            427,
            138,
            392,
            36,
            187,
            466,
            578,
            225,
            571,
            970,
            118,
            816,
            367,
            546,
            875,
            831,
        ],
        [1, 2, 3, 4, 5],
        [4, 5, 3, 2, 1],
        [1, 2, 3, 4, 5],
        [4, 3, 5, 1, 2],
        [
            675,
            927,
            460,
            545,
            391,
            961,
            936,
            523,
            256,
            705,
            790,
            209,
            131,
            65,
            59,
            73,
            545,
            255,
            833,
            100,
            451,
            679,
            709,
            632,
            432,
            855,
            447,
            428,
            153,
            412,
            462,
            815,
            786,
            638,
            916,
            192,
            433,
            302,
            352,
            115,
            544,
            952,
            274,
            751,
            904,
            230,
            237,
            748,
            444,
            659,
            981,
            60,
            144,
            886,
            546,
            840,
            777,
            330,
            104,
            466,
            670,
            608,
            835,
            676,
            671,
            227,
            468,
            118,
            702,
            67,
            123,
            856,
            313,
            435,
            754,
            767,
            182,
            43,
            602,
            708,
            902,
            895,
            11,
            419,
            845,
            367,
            21,
            128,
            712,
            766,
            350,
            455,
            377,
            226,
            509,
            819,
            633,
            770,
            65,
            905,
            570,
            26,
            582,
            152,
            916,
            343,
            235,
            746,
            533,
            990,
            210,
            483,
            70,
            661,
            94,
            275,
            544,
            763,
            103,
            214,
            741,
            939,
            702,
            451,
            851,
            954,
            36,
            765,
            267,
            415,
            936,
            258,
            203,
            108,
            522,
            213,
            369,
            8,
            586,
            409,
            695,
            387,
            825,
            127,
            198,
            999,
            363,
            469,
            160,
            134,
            294,
            598,
            281,
            748,
            185,
            694,
            414,
            116,
            975,
            148,
            64,
            877,
            978,
            73,
            950,
            31,
            266,
            709,
            33,
            122,
            714,
            234,
            877,
            756,
            378,
            766,
            875,
            557,
            742,
            522,
            315,
            329,
            262,
            463,
            253,
            196,
            202,
            241,
            431,
            496,
            176,
            512,
            871,
            261,
            474,
            505,
            654,
            919,
            746,
            189,
            979,
            499,
            31,
            963,
            322,
            559,
            691,
            12,
            111,
            699,
            86,
            493,
            829,
            256,
            83,
            824,
            25,
            220,
            926,
            135,
            296,
            876,
            754,
            737,
            767,
            888,
            245,
            590,
            711,
            634,
            247,
            411,
            211,
            801,
            378,
            142,
            642,
            104,
            54,
            800,
            867,
            576,
            813,
            29,
            427,
            866,
            867,
            393,
            890,
            757,
            553,
            997,
            641,
            750,
            90,
            95,
            720,
            839,
            878,
            967,
            885,
            974,
            271,
            856,
            991,
            145,
            130,
            791,
            635,
            277,
            995,
            688,
            233,
            398,
            318,
            27,
            513,
            967,
            379,
            229,
            448,
            84,
            607,
            131,
            939,
            898,
            683,
            727,
            957,
            659,
            703,
            269,
            213,
            543,
            664,
            401,
            434,
            438,
            785,
            6,
            557,
            344,
            496,
            835,
            679,
            724,
            825,
            805,
            698,
            631,
            109,
            494,
            93,
            995,
            984,
            418,
            949,
            952,
            921,
            596,
            736,
            439,
            9,
            472,
            927,
            547,
            888,
            742,
            270,
            719,
            430,
            417,
            629,
            493,
            367,
            980,
            316,
            677,
            174,
            325,
            716,
            579,
            51,
            798,
            5,
            340,
            799,
            575,
            363,
            184,
            408,
            706,
            71,
            448,
            133,
            9,
            775,
            139,
            275,
            187,
            748,
            866,
            863,
            954,
            460,
            969,
            586,
            227,
            975,
            371,
            365,
            417,
            640,
            993,
            425,
            375,
            546,
            998,
            425,
            18,
            737,
            470,
            309,
            195,
            376,
            389,
            573,
            336,
            970,
            625,
            158,
            335,
            841,
            248,
            310,
            978,
            440,
            530,
            569,
            578,
            15,
            440,
            594,
            22,
            496,
            767,
            673,
            570,
            890,
            539,
            229,
            214,
            215,
            255,
            959,
            575,
            848,
            661,
            332,
            388,
            570,
            113,
            390,
            259,
            718,
            399,
            188,
            803,
            797,
            28,
            485,
            259,
            394,
            566,
            642,
            866,
            653,
            278,
            160,
            512,
            196,
            144,
            806,
            436,
            919,
            846,
            259,
            620,
            108,
            430,
            48,
            51,
            95,
            859,
            504,
            499,
            663,
            645,
            544,
            353,
            902,
            302,
            814,
            920,
            168,
            283,
            545,
            409,
            742,
            318,
            611,
            644,
            853,
            921,
            861,
            311,
            713,
            828,
            863,
            506,
            332,
            473,
            798,
            856,
            88,
            402,
            289,
            94,
            713,
            501,
            677,
            205,
            631,
            512,
            616,
            644,
            84,
            428,
            870,
            849,
            894,
            432,
            777,
            944,
            511,
            446,
            148,
            160,
            448,
            668,
            247,
            217,
            813,
            535,
            151,
            173,
            452,
            180,
            741,
            483,
            125,
            615,
            813,
            34,
            441,
            900,
            234,
            170,
            343,
            663,
            755,
            984,
            525,
            391,
            552,
            433,
            242,
            975,
            591,
            505,
            580,
            48,
            484,
            558,
            247,
            300,
            67,
            252,
            842,
            818,
            512,
            880,
            886,
            452,
            671,
            977,
            710,
            375,
            549,
            341,
            203,
            699,
            319,
            475,
            989,
            820,
            415,
            893,
            959,
            669,
            431,
            77,
            108,
            619,
            71,
            97,
            889,
            116,
            778,
            282,
            817,
            592,
            860,
            325,
            28,
            209,
            454,
            176,
            354,
            716,
            566,
            182,
            260,
            246,
            719,
            406,
            211,
            777,
            303,
            552,
            487,
            105,
            329,
            709,
            602,
            86,
            907,
            561,
            517,
            551,
            796,
            484,
            106,
            230,
            966,
            954,
            393,
            479,
            875,
            982,
            773,
            857,
            58,
            359,
            780,
            547,
            89,
            355,
            355,
            762,
            970,
            707,
            387,
            855,
            887,
            496,
            873,
            271,
            30,
            756,
            694,
            174,
            557,
            663,
            402,
            166,
            191,
            753,
            276,
            674,
            820,
            381,
            755,
            891,
            698,
            701,
            968,
            55,
            611,
            655,
            320,
            526,
            1,
            569,
            394,
            415,
            243,
            256,
            309,
            141,
            630,
            855,
            338,
            543,
            675,
            134,
            740,
            519,
            405,
            451,
            977,
            662,
            841,
            334,
            418,
            398,
            425,
            386,
            991,
            581,
            170,
            856,
            279,
            276,
            406,
            391,
            696,
            274,
            826,
            27,
            955,
            314,
            759,
            134,
            188,
            210,
            205,
            462,
            222,
            593,
            341,
            711,
            589,
            598,
            47,
            951,
            888,
            37,
            194,
            454,
            654,
            462,
            774,
            47,
            176,
            472,
            92,
            307,
            344,
            996,
            451,
            231,
            566,
            562,
            849,
            148,
            13,
            787,
            798,
            498,
            403,
            799,
            903,
            557,
            688,
            253,
            212,
            9,
            889,
            590,
            504,
            571,
            632,
            527,
            839,
            66,
            5,
            761,
            432,
            80,
            262,
            699,
            495,
            900,
            980,
            320,
            716,
            395,
            674,
            434,
            553,
            108,
            521,
            296,
            890,
            46,
            424,
            460,
            615,
            892,
            407,
            590,
            932,
            961,
            907,
            936,
            999,
            998,
            438,
            968,
            439,
            505,
            399,
            351,
            140,
            872,
            62,
            951,
            506,
            193,
            894,
            441,
            958,
            538,
            630,
            72,
            555,
            312,
            192,
            46,
            454,
            923,
            78,
            963,
            572,
            850,
            934,
            998,
            969,
            864,
            396,
            463,
            249,
            208,
            947,
            377,
            494,
            933,
            642,
            708,
            200,
            450,
            969,
            260,
            261,
            923,
            922,
            900,
            111,
            837,
            886,
            287,
            499,
            655,
            301,
            748,
            0,
            655,
            980,
            201,
            766,
            108,
            546,
            537,
            206,
            735,
            2,
            551,
            769,
            446,
            731,
            614,
            13,
            933,
            269,
            813,
            305,
            248,
            524,
            540,
            883,
            225,
            486,
            869,
            425,
            314,
            562,
            999,
            754,
            601,
            22,
            309,
            983,
            246,
            108,
            655,
            26,
            197,
            290,
            326,
            591,
            89,
            990,
            151,
            206,
            631,
            394,
            568,
            420,
            397,
            47,
            434,
            712,
            680,
            593,
            91,
            359,
            264,
            961,
            355,
            292,
            55,
            542,
            334,
            664,
            165,
            806,
            547,
            130,
            975,
            933,
            761,
            400,
            136,
            453,
            876,
            787,
            754,
            115,
            305,
            346,
            411,
            665,
            392,
            417,
            644,
            625,
            276,
            482,
            37,
            454,
            265,
            410,
            473,
            128,
            550,
            882,
            556,
            724,
            557,
            783,
            759,
            86,
            686,
            268,
            343,
            613,
            609,
            266,
            609,
            243,
            482,
            761,
            177,
            977,
            17,
            27,
            842,
            261,
            587,
            624,
            58,
            15,
            161,
            34,
            980,
            497,
            818,
            288,
            153,
            10,
            623,
            174,
            161,
            427,
            138,
            392,
            36,
            187,
            466,
            578,
            225,
            571,
            970,
            118,
            816,
            367,
            546,
            875,
            831,
        ],
        [
            675,
            927,
            460,
            545,
            391,
            961,
            936,
            523,
            256,
            705,
            790,
            209,
            131,
            65,
            59,
            73,
            545,
            255,
            833,
            100,
            451,
            679,
            709,
            632,
            432,
            855,
            447,
            428,
            153,
            412,
            462,
            815,
            786,
            638,
            916,
            192,
            433,
            302,
            352,
            115,
            544,
            952,
            274,
            751,
            904,
            230,
            237,
            748,
            444,
            659,
            981,
            60,
            144,
            886,
            546,
            840,
            777,
            330,
            104,
            466,
            670,
            608,
            835,
            676,
            671,
            227,
            468,
            118,
            702,
            67,
            123,
            856,
            313,
            435,
            754,
            767,
            182,
            43,
            602,
            708,
            902,
            895,
            11,
            419,
            845,
            367,
            21,
            128,
            712,
            766,
            350,
            455,
            377,
            226,
            509,
            819,
            633,
            770,
            65,
            905,
            570,
            26,
            582,
            152,
            916,
            343,
            235,
            746,
            533,
            990,
            210,
            483,
            70,
            661,
            94,
            275,
            544,
            763,
            103,
            214,
            741,
            939,
            702,
            451,
            851,
            954,
            36,
            765,
            267,
            415,
            936,
            258,
            203,
            108,
            522,
            213,
            369,
            8,
            586,
            409,
            695,
            387,
            825,
            127,
            198,
            999,
            363,
            469,
            160,
            134,
            294,
            598,
            281,
            748,
            185,
            694,
            414,
            116,
            975,
            148,
            64,
            877,
            978,
            73,
            950,
            31,
            266,
            709,
            33,
            122,
            714,
            234,
            877,
            756,
            378,
            766,
            875,
            557,
            742,
            522,
            315,
            329,
            262,
            463,
            253,
            196,
            202,
            241,
            431,
            496,
            176,
            512,
            871,
            261,
            474,
            505,
            654,
            919,
            746,
            189,
            979,
            499,
            31,
            963,
            322,
            559,
            691,
            12,
            111,
            699,
            86,
            493,
            829,
            256,
            83,
            824,
            25,
            220,
            926,
            135,
            296,
            876,
            754,
            737,
            767,
            888,
            245,
            590,
            711,
            634,
            247,
            411,
            211,
            801,
            378,
            142,
            642,
            104,
            54,
            800,
            867,
            576,
            813,
            29,
            427,
            866,
            867,
            393,
            890,
            757,
            553,
            997,
            641,
            750,
            90,
            95,
            720,
            839,
            878,
            967,
            885,
            974,
            271,
            856,
            991,
            145,
            130,
            791,
            635,
            277,
            995,
            688,
            233,
            398,
            318,
            27,
            513,
            967,
            379,
            229,
            448,
            84,
            607,
            131,
            939,
            898,
            683,
            727,
            957,
            659,
            703,
            269,
            213,
            543,
            664,
            401,
            434,
            438,
            785,
            6,
            557,
            344,
            496,
            835,
            679,
            724,
            825,
            805,
            698,
            631,
            109,
            494,
            93,
            995,
            984,
            418,
            949,
            952,
            921,
            596,
            736,
            439,
            9,
            472,
            927,
            547,
            888,
            742,
            270,
            719,
            430,
            417,
            629,
            493,
            367,
            980,
            316,
            677,
            174,
            325,
            716,
            579,
            51,
            798,
            5,
            340,
            799,
            575,
            363,
            184,
            408,
            706,
            71,
            448,
            133,
            9,
            775,
            139,
            275,
            187,
            748,
            866,
            863,
            954,
            460,
            969,
            586,
            227,
            975,
            371,
            365,
            417,
            640,
            993,
            425,
            375,
            546,
            998,
            425,
            18,
            737,
            470,
            309,
            195,
            376,
            389,
            573,
            336,
            970,
            625,
            158,
            335,
            841,
            248,
            310,
            978,
            440,
            530,
            569,
            578,
            15,
            440,
            594,
            22,
            496,
            767,
            673,
            570,
            890,
            539,
            229,
            214,
            215,
            255,
            959,
            575,
            848,
            661,
            332,
            388,
            570,
            113,
            390,
            259,
            718,
            399,
            188,
            803,
            797,
            28,
            485,
            259,
            394,
            566,
            642,
            866,
            653,
            278,
            160,
            512,
            196,
            144,
            806,
            436,
            919,
            846,
            259,
            620,
            108,
            430,
            48,
            51,
            95,
            859,
            504,
            499,
            663,
            645,
            544,
            353,
            902,
            302,
            814,
            920,
            168,
            283,
            545,
            409,
            742,
            318,
            611,
            644,
            853,
            921,
            861,
            311,
            713,
            828,
            863,
            506,
            332,
            473,
            798,
            856,
            88,
            402,
            289,
            94,
            713,
            501,
            677,
            205,
            631,
            512,
            616,
            644,
            84,
            428,
            870,
            849,
            894,
            432,
            777,
            944,
            511,
            446,
            148,
            160,
            448,
            668,
            247,
            217,
            813,
            535,
            151,
            173,
            452,
            180,
            741,
            483,
            125,
            615,
            813,
            34,
            441,
            900,
            234,
            170,
            343,
            663,
            755,
            984,
            525,
            391,
            552,
            433,
            242,
            975,
            591,
            505,
            580,
            48,
            484,
            558,
            247,
            300,
            67,
            252,
            842,
            818,
            512,
            880,
            886,
            452,
            671,
            977,
            710,
            375,
            549,
            341,
            203,
            699,
            319,
            475,
            989,
            820,
            415,
            893,
            959,
            669,
            431,
            77,
            108,
            619,
            71,
            97,
            889,
            116,
            778,
            282,
            817,
            592,
            860,
            325,
            28,
            209,
            454,
            176,
            354,
            716,
            566,
            182,
            260,
            246,
            719,
            406,
            211,
            777,
            303,
            552,
            487,
            105,
            329,
            709,
            602,
            86,
            907,
            561,
            517,
            551,
            796,
            484,
            106,
            230,
            966,
            954,
            393,
            479,
            875,
            982,
            773,
            857,
            58,
            359,
            780,
            547,
            89,
            355,
            355,
            762,
            970,
            707,
            387,
            855,
            887,
            496,
            873,
            271,
            30,
            756,
            694,
            174,
            557,
            663,
            402,
            166,
            191,
            753,
            276,
            674,
            820,
            381,
            755,
            891,
            698,
            701,
            968,
            55,
            611,
            655,
            320,
            526,
            1,
            569,
            394,
            415,
            243,
            256,
            309,
            141,
            630,
            855,
            338,
            543,
            675,
            134,
            740,
            519,
            405,
            451,
            977,
            662,
            841,
            334,
            418,
            398,
            425,
            386,
            991,
            581,
            170,
            856,
            279,
            276,
            406,
            391,
            696,
            274,
            826,
            27,
            955,
            314,
            759,
            134,
            188,
            210,
            205,
            462,
            222,
            593,
            341,
            711,
            589,
            598,
            47,
            951,
            888,
            37,
            194,
            454,
            654,
            462,
            774,
            47,
            176,
            472,
            92,
            307,
            344,
            996,
            451,
            231,
            566,
            562,
            849,
            148,
            13,
            787,
            798,
            498,
            403,
            799,
            903,
            557,
            688,
            253,
            212,
            9,
            889,
            590,
            504,
            571,
            632,
            527,
            839,
            66,
            5,
            761,
            432,
            80,
            262,
            699,
            495,
            900,
            980,
            320,
            716,
            395,
            674,
            434,
            553,
            108,
            521,
            296,
            890,
            46,
            424,
            460,
            615,
            892,
            407,
            590,
            932,
            961,
            907,
            936,
            999,
            998,
            438,
            968,
            439,
            505,
            399,
            351,
            140,
            872,
            62,
            951,
            506,
            193,
            894,
            441,
            958,
            538,
            630,
            72,
            555,
            312,
            192,
            46,
            454,
            923,
            78,
            963,
            572,
            850,
            934,
            998,
            969,
            864,
            396,
            463,
            249,
            208,
            947,
            377,
            494,
            933,
            642,
            708,
            200,
            450,
            969,
            260,
            261,
            923,
            922,
            900,
            111,
            837,
            886,
            287,
            499,
            655,
            301,
            748,
            0,
            655,
            980,
            201,
            766,
            108,
            546,
            537,
            206,
            735,
            2,
            551,
            769,
            446,
            731,
            614,
            13,
            933,
            269,
            813,
            305,
            248,
            524,
            540,
            883,
            225,
            486,
            869,
            425,
            314,
            562,
            999,
            754,
            601,
            22,
            309,
            983,
            246,
            108,
            655,
            26,
            197,
            290,
            326,
            591,
            89,
            990,
            151,
            206,
            631,
            394,
            568,
            420,
            397,
            47,
            434,
            712,
            680,
            593,
            91,
            359,
            264,
            961,
            355,
            292,
            55,
            542,
            334,
            664,
            165,
            806,
            547,
            130,
            975,
            933,
            761,
            400,
            136,
            453,
            876,
            787,
            754,
            115,
            305,
            346,
            411,
            665,
            392,
            417,
            644,
            625,
            276,
            482,
            37,
            454,
            265,
            410,
            473,
            128,
            550,
            882,
            556,
            724,
            557,
            783,
            759,
            86,
            686,
            268,
            343,
            613,
            609,
            266,
            609,
            243,
            482,
            761,
            177,
            977,
            17,
            27,
            842,
            261,
            587,
            624,
            58,
            15,
            161,
            34,
            980,
            497,
            818,
            288,
            153,
            10,
            623,
            174,
            161,
            427,
            138,
            392,
            36,
            187,
            466,
            578,
            225,
            571,
            970,
            118,
            816,
            367,
            546,
            875,
            831,
        ],
    ];

    assertEquals(
        [false, true, true, false, true],
        Array(inputs.length / 2)
            .fill(0)
            .map((_, i) =>
                validateStackSequences(
                    inputs[i * 2],
                    inputs[(i * 2) + 1],
                )
            ),
    );
});
